home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / Programmer’s Time / Read Me < prev    next >
Text File  |  1996-06-22  |  3KB  |  37 lines

  1. Programmer’s Time
  2.  
  3. Chris Espinosa
  4. Apple Computer, Inc.
  5.  
  6.  
  7. Abstract
  8.  
  9. A programming project is always short of a common commodity: time.  Usually, “time” is created when the programmer offers an estimate of when a project will be completed.  This commodity “time” is consumed at a fixed rate starting at the moment of creation.
  10.  
  11. The Programmer’s Time hack creates more time by adjusting the system clock every other second to remove one second from the clock’s current time.  This has some notable effects:
  12.  
  13. • A project that is promised for six months can be completed in six months by the programmer’s clock, even though people not running this hack will be under the impression that twelve months have passed.
  14.  
  15. • Because it only affects programming time, it allows the programmer to work twenty hours and still leave eight hours for sleep.
  16.  
  17. • Benchmarks run on a machine running Programmer’s Time will also benefit, if they are constructed using the system clock for timing, rather than ticks.  Benchmark results may not be reproduceable on other machines, however.
  18.  
  19. Theory of Operation
  20.  
  21. Programmer’s Time runs as a background process that sleeps for two seconds, then removes one second from the system clock.  That’s it.  It probably fails for the Hack Contest by being too low-technology and too useful.
  22.  
  23. Implementation Notes
  24.  
  25. Programmer’s Time was implemented entirely in UserLand Frontier, in the UserTalk language.  It takes advantage of the Agents functionality in order to schedule its time.  This results in some interesting tradeoffs.  On the positive side, the hack consists of two lines of code.  On the negative side, it consumes 2.5Mb of system memory.  But hell, RAM is cheap and time isn’t.  Besides, Dave needs the help.
  26.  
  27. I also implemented Programmer’s Time in AppleScript, but it took more than two seconds to remove one second from the clock, so when you use it, time stands still.
  28.  
  29. How to Use
  30.  
  31. Copy to your system and install an alias to UserLand Frontier in your Startup Items folder.  From the moment you start up your Macintosh you will be on Programmer’s Time.
  32.  
  33. In addition you’ll have a nifty scripting environment installed and running, and access to the UserTalk language from any OSA attachable application or development environment.
  34.  
  35. Warnings
  36.  
  37. Because Programmer’s Time can only operate when it is getting cycles, certain operations that prevent background apps from getting time can cause Programmer’s Time to miss a tick.  Time will pass much more quickly if you’re doing hard work like compiles.  So don’t; you’ll find your project is actually completed in less Programmer’s Time if you do fewer compiles.